<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateCmsCategoryTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('cms_category', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name',90)->comment('分类名称');
            $table->string('en_name',90)->nullable()->comment('英文名称');
            $table->string('module',30)->nullable()->comment('模型');
            $table->integer('parent_id')->nullable()->default(0)->comment('父id');
            $table->integer('lft')->nullable()->comment('左边索引值');
            $table->integer('rgt')->nullable()->comment('右边索引值');
            $table->integer('depth')->nullable()->comment('层级深度');
            $table->string('icon',120)->nullable()->comment('图标');
            $table->string('image',120)->nullable()->comment('分类图片');
            $table->string('description',150)->nullable()->comment('描述');
            $table->text('setting')->nullable()->comment('设置');
            $table->unsignedInteger('listorder',false)->nullable()->default(0)->comment('排序');
            $table->unsignedInteger('limit_num',false)->nullable()->default(15)->comment('每页展示数量');
            $table->unsignedInteger('thumb_width',false)->default(320)->comment('列表图片宽度');
            $table->unsignedInteger('thumb_height',false)->default(240)->comment('列表图片高度');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('cms_category');
    }
}
